feat(stack-stripe): --webhook-endpoint flag creates and persists whsec#4
Open
masonwyatt23 wants to merge 2 commits intomainfrom
Open
feat(stack-stripe): --webhook-endpoint flag creates and persists whsec#4masonwyatt23 wants to merge 2 commits intomainfrom
masonwyatt23 wants to merge 2 commits intomainfrom
Conversation
stack add stripe --webhook-endpoint <url> [--events <e1,e2>] now:
- reuses or interactively pastes sk_live_… (or reads from vault via
--secret-key-from-vault)
- POSTs to /v1/webhook_endpoints using the Stripe secret key
- captures the whsec_… signing secret and we_… endpoint ID
- stores STRIPE_WEBHOOK_SECRET + STRIPE_WEBHOOK_ENDPOINT_ID in Phantom
so a future rotate command can update the same endpoint
Default event list is the subscription-lifecycle set (5 events). Custom
events passed via --events override it.
ProviderContext gains an optional `hints` field so providers can read
CLI flags during login(), not only during provision().
8 new tests cover: successful creation, custom events, default events,
missing-vault error path, Stripe API error propagation, and regression
guard for the plain sk_… flow.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…red) Assisted-By: ashlr-plugin <https://plugin.ashlr.ai>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
stack add stripe --webhook-endpoint <url> [--events <e1,e2,...>]now callsPOST /v1/webhook_endpoints, captures thewhsec_…signing secret, and storesSTRIPE_WEBHOOK_SECRET+STRIPE_WEBHOOK_ENDPOINT_IDin Phantom — fully agent-driveable with no Stripe dashboard copy-paste.--eventsis omitted):customer.subscription.{created,updated,deleted,trial_will_end}+invoice.payment_failed.--secret-key-from-vaultskips the interactivesk_…paste and reuses the existing vault entry.ProviderContextgains an optionalhintsfield so providers can inspect CLI flags duringlogin()(not only duringprovision()), enabling the vault-bypass path.stack add stripe(no webhook flag) is unchanged — regression-guarded by test (f).Files changed
packages/core/src/providers/stripe.ts— rewritten frommakeApiKeyProviderfactory to a hand-writtenProviderwith full webhook flowpackages/core/src/providers/_base.ts—ProviderContext.hints?: Record<string,unknown>addedpackages/core/src/pipeline.ts— threadsopts.hintsintoctxso login() can read itpackages/cli/src/commands/add.ts—--webhook-endpoint,--events,--secret-key-from-vaultflags +buildHints()helperpackages/core/src/__tests__/stripe-webhook.test.ts— 8 new tests (all mock fetch, never hit real Stripe)README.md— doc snippet showing all three invocation formsTest plan
bun testinpackages/core— 265 pass, 0 fail (includes 8 new stripe-webhook tests)bun run typecheckat repo root — clean--eventsforwarded to Stripe POST body--eventsomitted--secret-key-from-vaultthrowsSTRIPE_AUTH_REQUIREDwhen vault emptySTRIPE_WEBHOOK_CREATE_FAILEDstack add stripeflow (no webhook) unchanged🤖 Generated with Claude Code